package process

import (
	model "chat/client/models"
	message "chat/common"
	"fmt"
)

var OnlineUsers map[int]message.User = make(map[int]message.User, 10)
var CurUser model.CurUser

func outPutInlineUser() {
	fmt.Println("当前在线用户：")
	for _, v := range OnlineUsers {
		fmt.Println("用户名:\t", v.UserName)
	}
}
func updateUserStatus(notifyUserStatusMes *message.NotifyUserStatusMes) {
	user, ok := OnlineUsers[notifyUserStatusMes.UserId]
	if !ok {
		user = message.User{
			UserId:   notifyUserStatusMes.UserId,
			UserName: notifyUserStatusMes.UserName,
		}
	}
	user.UserStatus = notifyUserStatusMes.Status
	OnlineUsers[notifyUserStatusMes.UserId] = user
	outPutInlineUser()
}
